<?php

namespace app\factory\register;


use app\model\invite\BrowsingHistory;
use app\model\invite\Comment;
use app\model\invite\InviteModel;
use app\model\onlineChat\UserRoom;
use app\model\user\ForumUser;
use app\modelOpreate\invite\BrowsingHistoryOpe;
use app\modelOpreate\invite\CommentOpe;
use app\modelOpreate\invite\Invite;
use app\modelOpreate\onlineChat\ChatListOpe;
use app\modelOpreate\onlineChat\HistoryRecordOpe;
use app\modelOpreate\onlineChat\UserRoomOpe;
use app\modelOpreate\user\ForumUserOpe;
use app\tool\invite\PublishInviteHandler;
use app\tool\inviteList\InviteListHandle;
use app\tool\inviteList\PostListSelect;
use app\tool\inviteList\SendCommentHandler;
use app\tool\onlineChat\DynamicActionEnhancer;
use app\tool\onlineChat\MsgListSelect;
use app\tool\user\AttentionUserHandler;

/**
 * ClassName:一号注册类
 * @author leijunxiang
 * @time 2024/8/31
 * @auditor
 */
class RegToolOne
{

    /**
     * 注册工具()
     * @return void
     */
    public function regTool($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //帖子操作类
            case Invite::TOOL_INVITE_OPE:
                $obj = new Invite();
                bind($objKey, $obj);
                break;
            //发布帖子处理器
            case PublishInviteHandler::TOOL_PUBLISH_INVITE_HANDLER:
                $obj = new PublishInviteHandler();
                bind($objKey, $obj);
                break;
            //浏览记录操作类
            case BrowsingHistoryOpe::TOOL_BROWSING_HISTORY_OPE:
                $obj = new BrowsingHistoryOpe();
                bind($objKey, $obj);
                break;
            //发帖列表处理器
            case InviteListHandle::TOOL_INVITE_LIST_HANDLE:
                $obj = new InviteListHandle();
                bind($objKey, $obj);
                break;
            //用户操作类
            case ForumUserOpe::TOOL_FORUM_USER_OPE:
                $obj = new ForumUserOpe();
                bind($objKey, $obj);
                break;
            //评论操作器
            case CommentOpe::TOOL_COMMENT_OPE:
                $obj = new CommentOpe();
                bind($objKey, $obj);
                break;
            //帖子列表详情查询器
            case PostListSelect::TOOL_POST_LIST_SELECT:
                $obj = new PostListSelect();
                bind($objKey, $obj);
                break;
            //发布评论处理器
            case SendCommentHandler::TOOL_SEND_COMMENT_HANDLER:
                $obj = new SendCommentHandler();
                bind($objKey, $obj);
                break;
            //发布评论处理器
            case AttentionUserHandler::TOOL_ATTENTION_USER_HANDLER:
                $obj = new AttentionUserHandler();
                bind($objKey, $obj);
                break;
            //用户聊天列表操作对象
            case ChatListOpe::TOOL_CHAT_LIST_OPE:
                $obj = new ChatListOpe();
                bind($objKey, $obj);
                break;
            //历史记录
            case HistoryRecordOpe::TOOL_HISTORY_RECORD_OPE:
                $obj = new HistoryRecordOpe();
                bind($objKey, $obj);
                break;
            //用户房间操作表
            case UserRoomOpe::TOOL_USER_ROOM_OPE:
                $obj = new UserRoomOpe();
                bind($objKey, $obj);
                break;
            //消息列表查询器
            case MsgListSelect::TOOL_MSG_LIST_SELECT:
                $obj = new MsgListSelect();
                bind($objKey, $obj);
                break;
            //动态行为增加器
            case DynamicActionEnhancer::TOOL_DYNAMIC_ACTION_ENHANCER:
                $obj = new DynamicActionEnhancer();
                bind($objKey, $obj);
                break;


        }
        return $obj;
    }

    /**
     * 注册M层
     * @return void
     */
    public function regModel($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
            case ForumUser::MODEL_FORUM_USER:
                $obj = new ForumUser();
                bind($objKey, $obj);
                break;
            //帖子
            case InviteModel::MODEL_INVITE:
                $obj = new InviteModel();
                bind($objKey, $obj);
                break;
            case BrowsingHistory::MODEL_BROWSING_HISTORY:
                $obj = new BrowsingHistory();
                bind($objKey, $obj);
                break;
            case Comment::MODEL_COMMENT:
                $obj = new Comment();
                bind($objKey, $obj);
                break;
            //用户房间表
            case UserRoom::MODEL_USER_ROOM:
                $obj = new UserRoom();
                bind($objKey, $obj);
                break;
        }
        return $obj;
    }

    /**
     * 注册常驻M层
     * @return void
     */
    public function regResidentModel($objKey, $type)
    {
        $obj = null;
        if (empty($objKey) && empty($type)) {
            return null;
        }
        switch ($type) {
            //框架返回协议对象
//            case ResponseAgreement::MODEL_RESPONSE_AGREEMENT:
//                $obj = new ResponseAgreement();
//                bind($objKey, $obj);
//                break;
        }
        return $obj;
    }
}